package com.example.qa.service.application.service;

import com.example.qa.service.application.command.UpdateQasCommand;
import com.example.qa.service.application.port.in.UpdateQasUseCase;
import com.example.qa.service.domain.Qa;
import com.example.qa.service.domain.port.UpdateQaPort;
import com.example.qa.service.domain.valueobject.Answer;
import com.example.qa.service.domain.valueobject.QaId;
import com.example.qa.service.domain.valueobject.Question;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @program: qa-sys
 * @description:
 * @author: fks
 * @create: 2025-09-10 23:09
 **/
@Component
public class UpdateQasUseService implements UpdateQasUseCase {
    @Resource
    private UpdateQaPort updateQaPort;
    @Override
    public Void updateQas(UpdateQasCommand command) {
        Qa qa = new Qa(
                new Answer(command.answer()),
                new QaId(command.id().longValue()),
                new Question(command.question()));
         updateQaPort.updateQa(qa);
        return null;
    }
}
